<?php
ob_start();
define('IN_CLASS', true);
date_default_timezone_set('Asia/Shanghai');//设置时区
define( 'DIR_ROOT', dirname( __FILE__ ) . '/' );

require DIR_ROOT . 'cfg/cfg.inc.php'; //加载配置文件
include DIR_CFG . 'cfg.class.php';
include DIR_DAT . 'class.info.php';

include DIR_LIB . 'func.php'; //公共库文件
include DIR_LIB . 'class.page.php'; //分页类

include DIR_MDL . 'base.php'; //加载base
include DIR_MDL . 'model.php'; //加载model

include DIR_CTL . 'control.php'; //加载控制器基类

all::setcfg( $cfg ); //设置配置文件

$aOut['class'] = all::$cfg['class']; //班级信息
all::$aOut = $aOut; //全局输出变量

$m = empty($_REQUEST['m']) ? 'index' : func::input ( 'm' );
$a = empty($_REQUEST['a']) ? 'index' : func::input ( 'a' );

//允许操作的model
$aM = array('login','index','word','game','share','sms','member','pic','admin');
if( in_array( $m, $aM ) ) {
	if( file_exists( DIR_CTL . "$m.php" ) ) {
		include DIR_CTL . "$m.php";
	}
	$classname = $m.'control';
	$control = new $classname();
	$method = 'on'.$a;
	if(method_exists($control, $method) && $a{0} != '_') {
		$data = $control->$method();
		exit;
	} else {
		exit('Action not found!');
	}
}

exit('Module not found!');
?>
